<template>
	<view class="container">
		<view class="status-bar">
			<!-- <navbar :config="config" backColor="#fff"></navbar> -->
			<view class="topViewOne" :style="'height:' + sticky + 'px;padding-top:'+statusBarHeight +'px;'">
				<view class="search" style="padding-top: 31rpx;padding-bottom: 31rpx;height: 88rpx;">
					<!-- <view class="top"> -->
					<!-- <u-icon name="arrow-left" color="#020202" size="31" @click="backFun"></u-icon> -->
					<image :src="imgUrl+'/order/back.png'" @click="backFun" class="backImage">
						<div class="search-box">
							<div class="search-wap">
								<view class="searchImage">
									<image :src="imgUrl+'/search/search.png'" @click="goSearchConfirm">
									</image>
								</view>
								<input type="text" focus class="sput"
									placeholder-style="color: #474747;font-size: 28rpx" confirm-type="search"
									v-model="inputValue" placeholder="请输入搜索内容" @confirm="searchConfirm" />
							</div>
						</div>
						<!-- </view> -->
				</view>
				<!-- :style="{top:tabTop+'px'}" -->
				<view class="topview">
					<!--订单类型选择-->
					<scroll-view scroll-x="true" class="scrollbox ">
						<view class="order-type ">
							<view class="orderView" :class="{'active': isChange == index}"
								v-for="(item,index) in orderType" :key="index" @click="clickBtn(index)">
								{{item}}
							</view>
						</view>
					</scroll-view>
				</view>

			</view>



			<view class="plrbottom">
				<!--订单列表-->
				<view class="order-list" v-if="isChange==0||isChange==1">
					<view class="order-item" v-for="(item) in orderList" :key="item.id">
						<view class="listtwo" v-if="item.payment_status==5">
							<view class="childBox" v-for="ordersList in item.orders" :key="ordersList.id">
								<!-- u-border-one -->
								<view class="viewWidthTitleFView">
									<view class="viewWidthTitle">
										<image class="shopImage" :src="imgUrl+'/orderLIst/shopImage.png'">
										</image>
										<text class="labelClass">
											{{ordersList.shop.platform_shop === true ? '自营' : ordersList.shop_name}}
										</text>
										<image :src="imgUrl+'/personal/right.png'" class="rightClass"></image>
									</view>
									<view v-if="ordersList.end==true" class="stateClass">
										<text>交易完成</text>
									</view>
									<view v-if="ordersList.end==false" class="stateClass">
										<text v-if="ordersList.comment_status==2">交易完成</text>
										<text
											v-if="(ordersList.comment_status==0||ordersList.comment_status==1)&&ordersList.rights_type==0">{{ordersList.transaction_status | payStatus}}</text>
										<!-- <text class="u-FF721B u-font28" v-if="ordersList.rights_type >0">维权中</text> -->
									</view>
								</view>
								<view class="u-border-one-one"></view>
								<view v-for="childItem in ordersList.child_order_list" :key="childItem.id"
									@click="goProductDetails(childItem,childItem.source_shop_id,childItem.exchange,childItem.marketing_type)">
									<ldgoodss :value="childItem" :position="list" :isInter='ordersList.exchange'>
									</ldgoodss>
								</view>
								<!-- <view class="timeView">
									<view class="timeViewRight">
										<text>共{{item.goods_number}}件商品</text>，
										<text v-if="item.total_amount>0">总金额：</text>
										<view v-if="item.total_amount>0" class="timeViewRightNumber">
											<rich-text :nodes="$mUtil.priceBigSmall(item.total_amount)"></rich-text>
										</view> <text v-if="item.total_point>0">，总积分：{{item.total_point}}</text>
									</view>
									</view>
									<view class="u-flex-column-end u-mt30">
										<view class="btn-type u-flex">
											<view class="u-flex-center" style="justify-content: flex-end;"
												v-if="item.close_mode==0">
												<view class="pay-time"> <text class="iconfont yu-time">&#xe681;</text>
													支付剩余 <div style="width: 127rpx;text-align: center;">
														{{item | dateFilter}}
													</div>
												</view>
												<view class="payOrderView"
													@click="waitpayOrder(item.id,item.total_amount,item.expired_pay_time,item.area_feature)">
													立即付款
												</view>
											</view>
											<view v-if="item.close_mode==1" class="" class="payOrderView"
												@click="goOrderDetailsPay(item.id)">查看详情</view>
										</view>
									</view>
							
							</view> -->

								<view class="timeView">
									<view class="timeViewRight">
										<text>共{{ordersList.goods_number}}件商品</text><text
											v-if="ordersList.total_amount>0">，总金额</text>
										<view class="timeViewRightNumber" v-if="ordersList.total_amount>0">
											<rich-text
												:nodes="$mUtil.priceBigSmall(ordersList.total_amount)"></rich-text>
										</view> <text
											v-if="ordersList.total_point>0">，总积分：{{ordersList.total_point}}</text>
									</view>
									<view class="u-mt10" v-if="ordersList.should_freight*1 > 0">
										含运费+税费￥{{ordersList.should_freight}}</view>
								</view>
								<view class="payWaitViiew">
									<view class="btn-type u-flex">
										<!--待付款-->
										<view v-if="ordersList.transaction_status==0&&item.close_mode==0">
											<view class="pay-time"> <text class="iconfont yu-time">&#xe681;</text>
												支付剩余 <div style="width: 127rpx;text-align: center;">
													{{ordersList| dateFilter}}
												</div>
											</view>
											<view class="btn-item u-text-center u-FFF bg-FF721B">立即付款</view>
										</view>
										<!--等待发货-->
										<view class="buttonView"
											v-if="ordersList.transaction_status==1&&ordersList.rights_type==0">
											<view class="greyView"
												v-if="!ordersList.end&&ordersList.area_feature === 0 && ordersList.effective"
												@click="goRefundType(ordersList,1,ordersList.order_code,ordersList.format_order_time,ordersList.child_order_list,ordersList.id)">
												申请退款</view>

											<!-- <view class="btn-item u-text-center u-999 br-999" @click="goPhone(ordersList.mobile)">联系客服</view> -->
											<view class="greyView"
												v-if="ordersList.shipment_mode==0 && ordersList.third == false"
												@click="changeAddress(ordersList.id)">修改地址</view>
											<view class="greyView"
												@click="goOrderDetails(ordersList.id, ordersList.order_code, ordersList.shop_id)">
												查看详情</view>
										</view>
										<!--等待收货-->
										<view class="u-flex-center u-474747" style="justify-content: flex-end;"
											v-if="ordersList.transaction_status==2||ordersList.transaction_status==3||ordersList.transaction_status==4">
											<!-- @click="lookLoginsList(ordersList.id,ordersList.goods_number,ordersList.child_order_list[0].goods_img,1)" -->
											<view class="greyView" @click="lookLoginsListNew(ordersList.id,0)">
												查看物流</view>
											<view class="greyView" v-if="ordersList.shipment_mode==0"
												@click="sureGetOrder(ordersList.id,1)">确认收货</view>
											<view class="greyView"
												@click="goOrderDetails(ordersList.id, ordersList.order_code, ordersList.shop_id)">
												查看详情</view>
										</view>

										<!--待评价-->
										<view
											v-if="ordersList.transaction_status==5&&ordersList.comment_status==0&&!ordersList.end"
											@click="goRefundType(2,ordersList.order_code,ordersList.format_order_time,ordersList.child_order_list,item.id,ordersList.id)"
											class="btn-item u-text-center u-999 br-999">申请售后</view>
										<!-- 已评价 -->
										<!-- <view v-if="ordersList.transaction_status==5&&ordersList.comment_status==2&&!ordersList.end" class="btn-item u-text-center u-999 br-999" @click="goOrderDetails(ordersList.id)">查看详情</view> -->
										<view class="u-flex-center u-474747" style="justify-content: flex-end;"
											v-if="ordersList.transaction_status==5&&!ordersList.end">
											<view class="btn-item u-text-center u-474747 br-999"
												@click="goRefundType(ordersList,2,ordersList.order_code,ordersList.format_order_time,ordersList.child_order_list,item.id,ordersList.id)">
												申请售后</view>
											<view class="greyView"
												@click="goOrderDetails(ordersList.id, ordersList.order_code, ordersList.shop_id)">
												查看详情</view>
										</view>

										<view class="payOrderView" v-if="ordersList.transaction_status==6"
											@click="customerServiceFun(ordersList.order_code, ordersList.shop_id)">
											联系商家</view>

										<!--待提货-->
										<!-- <view v-if="ordersList.transaction_status==3 &&ordersList.shipment_mode==1" class="btn-item u-text-center u-999 br-999">确认提货</view> -->
										<!--申请退款中-->
										<!-- <view class="btn-item u-text-center u-999 br-999">查看详情</view> -->
									</view>
								</view>

							</view>
						</view>
						<view class="listone childBox" v-else>
							<!-- u-border-one -->
							<view class="viewWidthTitleFView">
								<view class="viewWidthTitle">
									<image class="shopImage" :src="imgUrl+'/orderLIst/shopImage.png'"></image>
									<text class="labelClass">自营</text>
									<image :src="imgUrl+'/personal/right.png'" class="rightClass"></image>
								</view>
								<text class="stateClass" v-if="item.close_mode==0">待付款</text>
								<text class="stateClass8" v-if="item.close_mode==1">已关闭</text>
								<text class="stateClass" v-if="item.close_mode==2">商家关闭</text>
								<text class="stateClass" v-if="item.close_mode==3">支付过期</text>
							</view>
							<view class="u-border-one-one"></view>
							<view class="listImg" @click="goOrderDetailsPay(item.id)">
								<image class="listimgGroup" :src="url" mode="" v-for="(url,index) in item.goods_images"
									:key="index">
								</image>
								<view>
									<view class="shopView" v-if="item.orders[0].child_order_list">
										<view class="shopViewItem">
											<view class="shopViewItemTitle">
												{{item.orders[0].child_order_list[0].goods_title}}
											</view>
											<view class="shopViewItemContent">
												￥{{item.orders[0].child_order_list[0].real_price}}</view>
										</view>
										<view class="shopViewItemNumber">
											数量：{{item.orders[0].child_order_list[0].number}}
										</view>
									</view>


								</view>
							</view>

							<view class="timeView"
								style="flex-wrap: wrap;flex-wrap: wrap;height: 140rpx;padding-top: 20rpx;">
								<view class="timeViewLeft" v-if="item.orders[0].child_order_list">
									{{item.orders[0].child_order_list[0].create_time}}
								</view>
								<view class="timeViewRight">
									<text>共{{item.goods_number}}件商品</text>，
									<text v-if="item.total_amount>0">总金额：</text>
									<view v-if="item.total_amount>0" class="timeViewRightNumber">
										<rich-text :nodes="$mUtil.priceBigSmall(item.total_amount)"></rich-text>
									</view> <text v-if="item.total_point>0">，总积分：{{item.total_point}}</text>
								</view>
								<view style="width: 100%;display: flex;justify-content: flex-end;padding: 20rpx 0;">
									<view class="payOrderView" style="margin: 0;"
										@click="customerServiceFun(item.orders[0].order_code, item.orders[0].shop_id)">
										联系商家</view>
								</view>
							</view>
							<!-- <view class="u-mt10">含运费￥10.00</view> -->
							<view class="u-flex-column-end ">
								<view class="btn-type u-flex">
									<!--待付款-->

									<view class="u-flex-center" style="justify-content: flex-end;"
										v-if="item.close_mode==0">
										<view class="pay-time"> <text class="iconfont yu-time">&#xe681;</text>
											<!-- （{{$mUtil.patTime(item.expired_pay_time)}}) -->
											支付剩余 <div style="width: 127rpx;text-align: center;">
												{{item | dateFilter}}
											</div>
										</view>
										<view class="payOrderView"
											@click="waitpayOrder(item.id,item.total_amount,item.expired_pay_time,item.area_feature)">
											立即付款
										</view>
										<view class="payOrderView" v-if="item.close_mode!=0"
											@click="customerServiceFun(item.orders[0].order_code, item.orders[0].shop_id)">
											联系商家</view>

									</view>

									<view v-if="item.close_mode==1" class="" class="payOrderView"
										@click="goOrderDetailsPay(item.id)">查看详情</view>
									<!-- {{item.close_mode}} -->
									<!-- v-if="item.transaction_status==3&&item.shipment_mode==0&&item.close_mode!=3" -->
									<!-- v-if="ordersList.transaction_status==2||ordersList.transaction_status==3||ordersList.transaction_status==4" -->

								</view>
							</view>

						</view>

					</view>
					<nodata v-if="noData" :config="{top:20,content:'暂无数据~'}"></nodata>
					<loadMore v-if="orderList.length>0" :status="status"></loadMore>
				</view>


				<!-- 待发货，待收货，待评价 -->
				<view class="order-list" v-if="isChange==2||isChange==3||isChange==4">
					<view class="order-item" v-for="(ordersList,index) in orderListOther" :key="ordersList.id">
						<view class="listtwo">
							<view class="childBox">

								<view class="viewWidthTitleFView">
									<view class="viewWidthTitle">
										<image class="shopImage" :src="imgUrl+'/orderLIst/shopImage.png'">
										</image>

										<text
											class="labelClass">{{ordersList.shop.platform_shop === true ? '自营' : ordersList.shop_name}}</text>
										<image :src="imgUrl+'/personal/right.png'" class="rightClass"></image>
									</view>
									<view v-if="ordersList.end==true">
										<text class="stateClass">交易完成</text>
									</view>
									<view v-if="ordersList.end==false">
										<text class="stateClass" v-if="ordersList.comment_status==2">交易完成</text>
										<text class="stateClass"
											v-if="(ordersList.comment_status==0||ordersList.comment_status==1)&&ordersList.rights_type==0">{{ordersList.transaction_status | payStatus}}</text>
										<!-- <text class="u-FF721B u-font28" v-if="ordersList.rights_type >0">维权中</text> -->
										<view class="stateClass back_status"
											v-if="ordersList.rights_status == 1 && ordersList.rights_type == 1">
											申请退款中</view>
										<view class="stateClass back_status"
											v-if="ordersList.rights_status == 1 && ordersList.rights_type == 2">
											申请退货中</view>
										<view class="stateClass back_status"
											v-if="ordersList.rights_status == 2 && ordersList.rights_type == 1">退款完成
										</view>
										<view class="stateClass back_status"
											v-if="ordersList.rights_status == 2 && ordersList.rights_type == 2">退货完成
										</view>
									</view>
								</view>
								<view class="u-border-one-one"></view>
								<view v-for="childItem in ordersList.child_order_list" :key="childItem.id"
									@click="goProductDetails(childItem,childItem.source_shop_id,childItem.exchange,childItem.marketing_type)">
									<ldgoodss :value="childItem" :position="list" :isInter='ordersList.exchange'>
									</ldgoodss>
								</view>
								<view class="timeView">
									<view class="timeViewRight">
										<text>共{{ordersList.goods_number}}件商品</text><text
											v-if="ordersList.total_amount>0">，总金额</text>
										<view class="timeViewRightNumber" v-if="ordersList.total_amount>0">
											<rich-text
												:nodes="$mUtil.priceBigSmall(ordersList.total_amount)"></rich-text>
										</view> <text
											v-if="ordersList.total_point>0">，总积分：{{ordersList.total_point}}</text>
									</view>
									<view class="u-mt10" v-if="ordersList.should_freight*1 > 0">
										含运费+税费￥{{ordersList.should_freight}}</view>
								</view>
								<view class="payWaitViiew">
									<view class="btn-type u-flex">
										<!--等待发货-->
										<view class="u-flex-center" style="justify-content: flex-end;"
											v-if="ordersList.transaction_status==1&&ordersList.rights_type==0">
											<button class="greyView"
												v-if="!ordersList.end&&ordersList.area_feature === 0 && ordersList.effective"
												@click="goRefundType(ordersList,1,ordersList.order_code,ordersList.format_order_time,ordersList.child_order_list,ordersList.id)">
												申请退款</button>
											<!-- <view class="btn-item u-text-center u-999 br-999"  @click="goPhone(ordersList.mobile)">联系客服</view> -->
											<button class="greyView"
												v-if="ordersList.shipment_mode==0 && ordersList.third == false"
												@click="changeAddress(ordersList.id)">修改地址</button>
										</view>
										<!--等待收货-->
										<view class="u-flex-center" style="justify-content: flex-end;"
											v-if="ordersList.transaction_status==3&&ordersList.shipment_mode==0">
											<!-- <view class="btn-item u-text-center u-999 br-999">申请退货</view> -->
											<!-- @click="lookLoginsList(ordersList.id,ordersList.goods_number,ordersList.child_order_list[0].goods_img,1)" -->
											<button class="greyView" @click="lookLoginsListNew(ordersList.id,0)">
												查看物流</button>
											<button class="greyView" v-if="ordersList.shipment_mode==0"
												@click="sureGetOrder(ordersList.id,2)">确认收货</button>
										</view>

										<!--待评价-->
										<button v-if="ordersList.transaction_status==5&&!ordersList.end"
											class="greyView"
											@click="goRefundType(ordersList,2,ordersList.order_code,ordersList.format_order_time,ordersList.child_order_list,orderListOther.id,ordersList.id)">
											申请售后</button>
										<button  v-if="ordersList.transaction_status==5&&!ordersList.end" @click="goSublevelPage(ordersList.order_code,'/pages/user/writeOffOrder/writeOffOrder')">
											<view class="greyView">核销订单</view>
										</button>
										<!-- 	<view class="btn-item u-text-center u-474747 br-999"
											@click="lookLoginsListNew(ordersList.id,0)">
											查看物流</view> -->
										<!--待提货-->

										<!-- <view v-if="ordersList.transaction_status==3 &&ordersList.shipment_mode==1" class="btn-item u-text-center u-999 br-999">确认提货</view> -->
										<!--申请退款中-->
										<button class="greyView"
											@click="goOrderDetails(ordersList.id, ordersList.order_code, ordersList.shop_id)">查看详情</button>
									</view>
								</view>


							</view>
						</view>

					</view>
					<nodata v-if="noData" :config="{top:20,content:'暂无数据~'}"></nodata>
					<loadMore v-if="orderListOther.length>0" :status="status"></loadMore>
				</view>



				<!-- 退款退货 -->
				<view class="order-list" v-if="isChange==5">
					<view class="order-item" v-for="(ordersList) in orderListblack" :key="ordersList.id">
						<view class="listtwo">
							<!-- u-border-one -->
							<view class="childBox">
								<view class="viewWidthTitleFView">
									<view class="viewWidthTitle">
										<image class="shopImage" :src="imgUrl+'/orderLIst/shopImage.png'">
										</image>
										<text
											class="labelClass">{{ordersList.order.shop.platform_shop === true ? '自营' : ordersList.shop_name}}</text>
										<image :src="imgUrl+'/personal/right.png'" class="rightClass"></image>
									</view>
									<text class="stateClass"
										v-if="ordersList.rights_type==1">{{ordersList.rights_operate_status | payStatusRight}}</text>
									<text class="stateClass"
										v-if="ordersList.rights_type==2">{{ordersList.rights_operate_status | payStatusRights}}</text>
								</view>
								<view class="u-border-one-one"></view>
								<view v-for="childItem in ordersList.rights_child_orders" :key="childItem.id"
									@click="goProductDetails(childItem,childItem.shop_id,childItem.exchange,childItem.marketing_type)">
									<ldgoodsbalcks :value="childItem" :third="ordersList.third" :position="list">
									</ldgoodsbalcks>
								</view>
								<view class="timeView">
									<view class="timeViewRight">
										<text>共{{ordersList.refund_num}}件商品，退款金额</text>
										<view class="timeViewRightNumber">
											<rich-text
												:nodes="$mUtil.priceBigSmall(ordersList.refund_money)"></rich-text>
										</view>
									</view>
								</view>
								<view class="payWaitViiew">
									<!-- 	<view class="btn-type u-flex">
										<view class="u-flex-center" style="justify-content: flex-end;"> -->
									<view class="btn-type u-flex">
										<view class="greyView"
											@click="gotoBalckDetail(ordersList.id,ordersList.shop_id,ordersList.rights_type,ordersList.rights_operate_status)">
											查看详情</view>
										<view class="payOrderView"
											@click="customerServiceFun(ordersList.order_code, ordersList.shop_id)">
											联系商家</view>
										<!-- <view class="btn-item u-text-center u-999 br-999" @click="goPhone(ordersList.mobile)">联系客服</view> -->
										<view class="greyView"
											@click="lookLoginsList(ordersList.id,ordersList.refund_num,ordersList.rights_child_orders[0].goods_img,2)"
											v-if="ordersList.rights_type==2&&ordersList.rights_operate_status==2">
											查看物流</view>
										<view class="greyView"
											@click="gotoBalckDetail(ordersList.id,ordersList.shop_id,ordersList.rights_type,ordersList.rights_operate_status)"
											v-if="ordersList.rights_type==2&&ordersList.rights_operate_status==1">
											去发货</view>
									</view>
								</view>
								<!-- </view>
								</view> -->

							</view>
						</view>

					</view>
					<nodata v-if="noData" :config="{top:20,content:'暂无数据~'}"></nodata>
					<loadMore v-if="orderListblack.length>0" :status="status"></loadMore>
				</view>
			</view>
			<!--页面加载动画-->
			<ldLoading isFullScreen :active="loading"></ldLoading>
		</view>
	</view>
</template>

<script>
	import ldgoodss from "@/pages/order/orderList/components/ld-goods/ld-goods.vue"
	import ldgoodsbalcks from "@/pages/order/orderList/components/ld-goods/ld-goods-black.vue"
	let vObj
	var app = getApp()
	export default {
		components: {
			ldgoodsbalcks,
			ldgoodss
		},
		beforeCreate() {
			vObj = this
		},
		data() {
			return {
				statusBarHeight: uni.getSystemInfoSync().statusBarHeight,
				sticky: uni.getSystemInfoSync().statusBarHeight + 60,
				imgUrl: this.$mConfig.staticUrl,
				list: 1,
				timeCount: 0,
				timer: null,
				config: {
					back: true, //false是tolbar页面 是则不写
					title: '',
					color: '#fff',
					//背景颜色;参数一：透明度（0-1）;参数二：背景颜色（array则为线性渐变，string为单色背景）
					backgroundColor: [1, "#fff"],
					statusBarFontColor: '#1A1A1A',
					// backTabPage: '/pages/index/personal',
					backTabPage: '/pages/index/personal'
				},
				isChange: 0,
				orderType: ["全部订单", "待付款", "待发货", "待收货", "待评价", "退款/退货"],
				shopStatus: true, //发货状态
				loading: true,
				orderList: [], //全部订单，待支付
				orderListOther: [], //待发货,待收货,待评价
				orderListblack: [],
				status: 'more', //more|loading|noMore
				noData: false,
				parmas: {
					page: 1,
					limit: 10,
				},
				parmasother: {
					page: 1,
					limit: 10,
				},
				parmasblack: {
					page: 1,
					limit: 10,
				},
				orderid: null,
				currentKey: null,
				tabTop: 0
			}
		},
		onReachBottom(e) {
			this.status = 'loading'
			if (this.isChange == 0) {
				this.parmas.page++
				this.getOrderList()
			} else if (this.isChange == 1) {
				this.parmas.page++
				this.waitPay()
			} else if (this.isChange == 5) {
				this.parmasblack.page++
				this.blackPay()
			} else {
				this.parmasother.page++
				let key = 1
				if (this.isChange == 2) {
					key = 1
				} else if (this.isChange == 3) {
					key = 3
				} else if (this.isChange == 4) {
					key = 5
				}
				this.otherPay(key)
			}

		},
		onPullDownRefresh() {
			this.rest()
			if (this.isChange == 0) {
				this.getOrderList()
			} else if (this.isChange == 1) {
				this.waitPay()
			} else if (this.isChange == 5) {
				this.blackPay()
			} else {
				let key = 1
				if (this.isChange == 2) {
					key = 1
				} else if (this.isChange == 3) {
					key = 3
				} else if (this.isChange == 4) {
					key = 5
				}
				this.otherPay(key)
			}

		},
		//返回到登录页面
		// onBackPress() {
		//   uni.switchTab({
		//     url: "../../index/personal"
		//   })
		//   return true
		// },
		onLoad(options) {
			let that = this
			that.timer = setInterval(() => {
				that.timeCount++
			}, 1000)

			this.tabTop = app.globalData.barHeight + 44;

			//区域类型
			if (options.orderType) {
				this.parmas.area_feature = options.orderType;
				this.parmasblack.area_feature = options.orderType;
				this.parmasother.area_feature = options.orderType;
			}

			if (options.keys) {
				if (options.keys == -1) {
					this.isChange = 0
					this.getOrderList()
				} else if (options.keys == 0) {
					this.isChange = 1
					this.waitPay()
				} else if (options.keys == 6) {
					this.isChange = 5
					this.blackPay()
				} else {
					if (options.keys == 1) {
						this.isChange = 2
					} else if (options.keys == 3) {
						this.isChange = 3
					} else if (options.keys == 5) {
						this.isChange = 4
					}
					this.currentKey = options.keys
					this.otherPay(options.keys)
				}
			} else {
				this.getOrderList()
			}
		},
		beforeDestroy() {
			clearInterval(this.timer)
		},
		filters: {
			dateFilter(item) {
				// console.log(item.expired_pay_time)
				let time = item.expired_pay_time - item.now_millis - vObj.timeCount * 1000;


				let str = vObj.$mUtil.countDownClock(time)

				return str
			},
			payStatus(val) {
				switch (val) {
					case 0:
						return "待支付"
						break;
					case 1:
						return "待发货"
						break;
					case 2:
						return "部分发货"
						break;
					case 3:
						return "待收货"
						break;
					case 4:
						return "已收货"
						break;
					case 5:
						return "待评价"
						break;
					case 6:
						return "关闭"
						break;
					default:
						break;
				}
			},
			payStatusRight(val) { //退款
				//维权订单操作状态（0申请，1同意，2买家已发货，3商家已收到退货商品,4商家发起退款支付，5已支付退款,6拒绝，7自动关闭,8主动撤消
				switch (val) {
					case 0:
						return "申请退款中"
						break;
					case 1:
						return "商家同意"
						break;
					case 4:
						return "商家发起退款支付"
						break;
					case 5:
						return "退款成功"
						break;
					case 6:
						return "商家拒绝"
						break;
					default:
						break;
				}
			},
			payStatusRights(val) { //退款退货
				//维权订单操作状态（0申请，1同意，2买家已发货，3商家已收到退货商品,4商家发起退款支付，5已支付退款,6拒绝，7自动关闭,8主动撤消
				switch (val) {
					case 0:
						return "申请退款/退货中"
						break;
					case 1:
						return "等待买家发货"
						break;
					case 2:
						return "待商家收货"
						break;
					case 3:
						return "商家已收货"
						break;
					case 4:
						return "商家待打款"
						break;
					case 5:
						return "退款/退货成功"
						break;
					case 6:
						return "商家拒绝"
						break;
					case 7:
						return "自动关闭"
						break;
					case 8:
						return "撤销"
						break;
					default:
						break;
				}
			}
		},
		methods: {
			//跳转页面
			goSublevelPage(ordercode,page) {  
			    const url = `${page}?ordercode=${ordercode}`; // 拼接 URL  
			    uni.navigateTo({  
			        url: url  
			    });  
			},
			backFun() {
				uni.navigateBack({
					delta: 1
				})
			},
			goProductDetails(item, shopid, exchange, marketing_type) {
				if (exchange) {
					uni.navigateTo({
						url: "/pages/product/goods/IntegralGood?id=" + item.goods_id + "&shopid=" + shopid
					})
				}
				if (marketing_type == 1) {
					uni.navigateTo({
						url: "/pages/product/goods/seckillGoods?id=" + item.activity_goods_id + "&shopid=" + shopid
					})
				}
				if (marketing_type == 2) {
					uni.navigateTo({
						url: "/pages/product/goods/puzzleGoods?id=" + item.activity_goods_id + "&shopid=" + shopid
					})
				}
				if (marketing_type == 0 && exchange == false) {
					uni.navigateTo({
						url: "/pages/product/goods/goods?id=" + item.goods_id
					})
				}

			},
			goPhone(phone) {
				if (phone) {
					uni.makePhoneCall({
						phoneNumber: phone //仅为示例
					});
				}
			},
			// 物流//type：1普通订单，2维权订单
			lookLoginsList(orderid, num, img, type) {
				uni.navigateTo({
					url: "../logistics?id=" + orderid + "&num=" + num + "&img=" + img + "&type=" + type,
				})
			},
			// 物流//type：1普通订单，2维权订单
			lookLoginsListNew(orderid, index) {
				uni.navigateTo({
					url: "../logisticsNew?id=" + orderid + "&index=" + index,
				})
			},
			//申请售后
			goRefundType(obj, i, code, time, list, orderid, childid) {
				//i:1未发货，退款，2收到货退款/退货
				uni.setStorageSync('blackgoodsList', list)
				if (obj.third) {
					uni.navigateTo({
						url: "refundType?order_code=" + code + '&format_order_time=' + time + '&keystatus=3' +
							"&orderid=" + orderid + "&childid=" + childid
					})
				} else {
					if (i == 1) {
						uni.navigateTo({
							url: "applicationDrawback?keystatus=" + i + "&title=申请退款" + "&orderid=" + orderid
						})
					} else {
						uni.navigateTo({
							url: "refundType?order_code=" + code + '&format_order_time=' + time + '&keystatus=' +
								i +
								"&orderid=" + orderid + "&childid=" + childid
						})
					}
				}
			},
			//确认收货
			sureGetOrder(id, k) {
				uni.showModal({
					title: '提示',
					content: '确定已经收到了该商品？',
					success: (res) => {
						if (res.confirm) {
							this.$http.post('/order/receipt', {
									order_id: id
								})
								.then(res => {
									if (res && res.code == 200) {
										this.$mUtil.toast('收货成功')
										this.rest()
										if (k == 1) {
											this.getOrderList()
										} else if (k == 2) {
											this.otherPay(this.currentKey)
										}

									}
								})
						} else if (res.cancel) {

						}
					}
				});
			},
			//选完地址回选
			otherFun(object) {
				if (!!object) {
					console.log(object.addressid)
					this.$http.put('/order/update-receipt/' + this.orderid + '/' + object.addressid)
						.then(res => {
							if (res && res.code == 200) {
								this.$mUtil.toast('修改成功')
							}
						})
				}
			},
			//修改地址
			changeAddress(id) {
				this.orderid = id
				uni.navigateTo({
					url: '/pages/user/address/addressList'
				})
			},
			rest() {
				this.parmas.page = 1
				this.parmasother.page = 1
				this.parmasblack.page = 1
				this.orderList = []
				this.orderListOther = []
				this.orderListblack = []
			},
			getOrderList() {
				this.$http.get('/pay/order/all/page', this.parmas)
					.then(res => {
						this.loading = false;
						if (res && res.code == 200) {
							// console.log(res)
							uni.stopPullDownRefresh()
							this.orderList = this.orderList.concat(res.page.list)
							if (this.orderList.length == 0) {
								this.noData = true
							} else {
								this.noData = false
							}
							if (res.page.totalPage <= res.page.currPage) {
								this.status = 'noMore'
							} else {
								this.status = 'more'
							}
						}
					})
			},
			waitPay() {
				this.$http.get('/pay/order/wait/page', this.parmas)
					.then(res => {
						this.loading = false;
						if (res && res.code == 200) {
							uni.stopPullDownRefresh()
							this.orderList = this.orderList.concat(res.page.list)
							if (this.orderList.length == 0) {
								this.noData = true
							} else {
								this.noData = false
							}
							if (res.page.totalPage <= res.page.currPage) {
								this.status = 'noMore'
							} else {
								this.status = 'more'
							}
						}
					})
			},
			otherPay(k) {
				this.parmasother.transaction_status = k //0已下单,待支付，1待发货（待备货） 3,"待收货（待自提）",5交易完成
				this.$http.get('/order/page', this.parmasother)
					.then(res => {
						this.loading = false;
						if (res && res.code == 200) {
							uni.stopPullDownRefresh()

							this.orderListOther = this.orderListOther.concat(res.page.list)
							console.log(this.orderListOther)
							if (this.orderListOther.length == 0) {
								this.noData = true
							} else {
								this.noData = false
							}
							if (res.page.totalPage <= res.page.currPage) {
								this.status = 'noMore'
							} else {
								this.status = 'more'
							}
						}
					})
			},
			blackPay() {
				this.$http.get('/rights/page', this.parmasblack)
					.then(res => {
						this.loading = false;
						if (res && res.code == 200) {
							uni.stopPullDownRefresh()
							this.orderListblack = this.orderListblack.concat(res.page.list)
							console.log(this.orderListblack)
							if (this.orderListblack.length == 0) {
								this.noData = true
							} else {
								this.noData = false
							}
							if (res.page.totalPage <= res.page.currPage) {
								this.status = 'noMore'
							} else {
								this.status = 'more'
							}
						}
					})
			},
			clickBtn(index) {
				this.rest()
				this.isChange = index
				if (index == 0) {
					this.getOrderList()
				} else if (index == 1) {
					this.waitPay()
				} else if (index == 2 || index == 3 || index == 4) {
					let key = 1
					if (index == 2) {
						key = 1
					} else if (index == 3) {
						key = 3
					} else if (index == 4) {
						key = 5
					}
					this.currentKey = key
					this.otherPay(key)
				} else { //退货/退款
					this.blackPay()
				}
			},
			//支付
			waitpayOrder(id, total_amount, expired_pay_time, area_feature) {
				uni.navigateTo({
					url: '../../order/pay?id=' + id + '&total_amount=' + total_amount + '&expired_pay_time=' +
						expired_pay_time + '&area_feature=' + area_feature
				})
			},
			//详情页
			goOrderDetails(id, orderCode, shopId) {
				uni.navigateTo({
					url: "orderDetails?id=" + id + '&status=pay&orderCode=' + orderCode + "&shopId=" + shopId
				})
			},
			gotoBalckDetail(id, shopid, type, status) {
				console.log("id", id, "shopid", shopid, "type", type, "status", status)
				uni.navigateTo({
					url: "orderblackDetails?id=" + id + "&shopid=" + shopid + "&type=" + type + "&status=" + status
				})
			},

			//支付订单
			goOrderDetailsPay(id) {
				uni.navigateTo({
					url: "orderDetails?id=" + id + '&status=waitpay'
				})
			},
			// 联系商家
			async customerServiceFun(code, shopId) {
				// let res = await this.$http.post(checkOnline, {
				// 	shopId: shopId
				// })
				// if (res.code == 200 && res.data.accid != null) {
				// 	const id = 'p2p-' + res.data.accid;
				// 	await uni.$UIKitStore.uiStore.selectSession(id);
				// 	uni.navigateTo({
				// 		url: "/pages/imv9/index?id=" + code,
				// 	});
				// }
				uni.navigateTo({
					url: "/pages/imv9/tipsPages?shopId=" + shopId + "&id=" + code,
				});
			}
		},

	}
</script>

<style lang="scss">
	// page {
	//   background-color: #F5F5F5;
	// }
	.viewWidthTitleFView {
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		padding-right: 19rpx;
		padding-top: 21rpx;
	}

	.viewWidthTitle {
		display: flex;
		align-items: center;
		flex-direction: row;
		justify-content: flex-start;
		padding-left: 19rpx;

		.right-icon {
			margin-top: 4rpx;
		}
	}

	.right-icon {
		font-size: 30rpx;
	}

	.plrbottom {
		padding: 0 19rpx;
		margin-top: 260rpx;
	}

	.topview {
		background-color: #fff;
		height: auto;
		width: 100%;
		box-sizing: border-box;
		// padding: 0 30rpx;
		margin: 0 auto;
		margin-top: 19rpx;
		margin-bottom: 19rpx;
		padding: 0 19rpx;
		padding-bottom: 19rpx;

	}

	.scrollbox {
		white-space: nowrap;

	}

	.pt-pb {
		padding: 30rpx;
	}

	.pt15-pb24 {
		padding-top: 24rpx;
		padding-bottom: 24rpx;
	}

	.br-FF721B {
		border: 1px solid #FF721B;
	}

	// .bg-FF721B {
	// 	background: #FF721B;
	// }

	.br-999 {
		border: 1px solid #E6E6E6;
	}

	.order-type {
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		white-space: nowrap;
		overflow: scroll;

		// position:fixed;
		// z-index: 9999999;

		.type-name {
			border-radius: 30px;
			padding: 12rpx 18rpx;
			display: inline-block;
			background: #ECECEC;
			color: #474747;
			margin-right: 10rpx;
		}
	}

	.listImg {
		margin-top: 37rpx;
		margin-left: 19rpx;
		display: flex;
		flex-direction: row;
		justify-content: flex-start;
		align-items: center;
	}

	.listimgGroup {
		width: 135rpx;
		height: 135rpx;
	}

	.order-item {
		width: 712rpx;
		height: auto;
		background: #FFFFFF;
		border-radius: 19rpx 19rpx 19rpx 19rpx;

		.btn-type {
			padding-bottom: 19rpx;

			.pay-time {
				line-height: 70rpx;
				margin-left: auto;
				display: flex;
				color: #474747;

				.yu-time {
					color: #AAAAAA;
					margin-right: 5rpx;
				}
			}

			.btn-item {
				width: 200rpx;
				height: 70rpx;
				line-height: 68rpx;
				border-radius: 35px;
				margin-left: 16rpx;
			}
		}
	}

	.childBox {
		margin-top: 19rpx;
	}

	.top {}

	.search {
		background-color: #fff;
		height: 104rpx;
		display: flex;
		flex-direction: row;
		justify-content: flex-start;
		align-items: center;
		padding-left: 11rpx;
		width: 100%;
	}

	.search-box {
		// width: 481rpx;
		width: 650rpx;
		height: 65rpx;
		background: #F5F5F5;
		border-radius: 15rpx 15rpx 15rpx 15rpx;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		padding-right: 8rpx;
		margin-left: 27rpx;

		.search-wap {
			display: flex;
			flex-direction: row;
			align-items: center;
			background: #F4F4F4;
			// border: 1px solid rgba(255, 255, 255, 0.42);
			border-radius: 30rpx;
			position: relative;
			justify-content: space-between;
			padding-left: 19rpx;

			.search-icon {
				font-size: 18px;
				margin-left: 30rpx;
				color: #474747;
			}

			.sput {
				margin-left: 25rpx;
				font-size: 22rpx;
				color: #474747;
				width: 100%;
			}
		}

		.word {
			width: 85rpx;
			height: 50rpx;
			background: #FF211F;
			border-radius: 12rpx 12rpx 12rpx 12rpx;
			font-weight: 400;
			font-size: 23rpx;
			color: #FFFFFF;
			display: flex;
			flex-direction: row;
			justify-content: center;
			align-items: center;
		}
	}

	.searchImage {
		width: 32rpx !important;
		height: 32rpx !important;
	}

	.searchImage image {
		width: 32rpx !important;
		height: 32rpx !important;
	}


	.active {
		width: 138rpx;
		height: 56rpx;
		background: #FF211F !important;
		border-radius: 15rpx 15rpx 15rpx 15rpx;
		font-weight: 400;
		font-size: 25rpx;
		color: #FFFFFF !important;
		line-height: 25rpx;
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;
		// margin-right: 21rpx;
		padding-top: 15rpx;
		padding-bottom: 15rpx;
		padding-left: 19rpx;
		padding-bottom: 19rpx;
		box-sizing: border-box;
	}

	.orderView {
		width: 106rpx;
		height: 50rpx;
		background: rgba(0, 0, 0, 0.03);
		border-radius: 10rpx;
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;
		// margin-right: 16rpx;
		padding-top: 15rpx;
		padding-bottom: 15rpx;
		padding-left: 10rpx;
		padding-right: 10rpx;
		box-sizing: border-box;
		font-size: 12PX;


	}

	.orderView :last-child {
		margin-right: 0 !important;
	}

	.order-list {}

	.shopImage {
		width: 35rpx;
		height: 35rpx;
	}

	.labelClass {
		font-weight: 400;
		font-size: 27rpx;
		color: #333333;
		line-height: 23rpx;
		margin: 0 8rpx;
	}

	.rightClass {
		width: 8rpx;
		height: 16rpx;
	}

	.stateClass {
		font-weight: 400;
		font-size: 27rpx;
		color: #FF211F;
		line-height: 38rpx;
	}

	.shopView {
		display: flex;
		flex-direction: column;
		justify-content: flex-start;
		align-items: flex-start;
		margin-left: 19rpx;

	}

	.shopViewItem {
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		width: 520rpx;
	}

	.shopViewItemTitle {
		width: 394rpx;
		height: 38rpx;
		font-weight: 400;
		font-size: 27rpx;
		color: #333333;
		line-height: 38rpx;
		text-align: justified;
		font-style: normal;
		text-transform: none;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.shopViewItemContent {
		width: auto;
		height: 38rpx;
		font-weight: 400;
		font-size: 27rpx;
		color: #999999;
		line-height: 38rpx;
		text-align: justified;
		font-style: normal;
		text-transform: none;
	}

	.shopViewItemNumber {
		font-weight: 400;
		font-size: 23rpx;
		color: #999999;
		line-height: 23rpx;
		text-align: left;
		font-style: normal;
		text-transform: none;
		margin-top: 19rpx;
	}


	.payWaitViiew {
		display: flex;
		flex-direction: row;
		justify-content: flex-end;
		align-items: center;
		width: 100%;
	}

	.payOrderView {
		width: 162rpx;
		height: 62rpx;
		background: #FF211F;
		border-radius: 12rpx 12rpx 12rpx 12rpx;
		font-weight: 400;
		font-size: 27rpx;
		color: #FFFFFF;
		line-height: 38rpx;
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;
		margin-left: 19rpx;
		margin-right: 19rpx;
	}

	.greyView {
		width: 162rpx;
		height: 62rpx;
		border-radius: 12rpx 12rpx 12rpx 12rpx;
		border: 2rpx solid #999999;
		font-weight: 400;
		font-size: 27rpx;
		color: #999999;
		line-height: 38rpx;
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;
		margin-right: 19rpx;
	}

	.buttonView {
		display: flex;
		flex-direction: row;
		justify-content: flex-end;
		align-items: center;
	}

	.timeView {
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		width: 100%;
		height: 96rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		border-top: 2rpx solid #F5F5F5;
		margin-top: 19rpx;
		padding: 0 19rpx;
		box-sizing: border-box;
	}

	.timeViewLeft {
		font-weight: 400;
		font-size: 23rpx;
		color: #999999;
		line-height: 23rpx;
		text-align: left;
		font-style: normal;
		text-transform: none;
	}

	.timeViewRight {
		font-weight: 400;
		font-size: 14px;
		color: #333333;
		line-height: 20px;
		text-align: justified;
		font-style: normal;
		text-transform: none;
		display: flex;
		flex-direction: row;
		justify-content: flex-end;
		align-items: cneter;
		// flex: 1;
	}

	.timeViewRightNumber {
		font-weight: 400;
		font-size: 27rpx;
		color: #FF211F;
		line-height: 38rpx;
		text-align: justified;
		font-style: normal;
		text-transform: none;
	}

	.backImage {
		width: 17rpx;
		height: 31rpx;
		padding-left: 26rpx;
	}

	.topViewOne {
		position: fixed;
		top: 0;
		left: 0;
		background-color: #fff;
		z-index: 10000;
		height: auto;
		width: 100%;


	}
</style>